package com.example.consumptionrecords.entity.enums;

/**
 * 孙敬佳
 * 2023 \ 08 \ 29
 */

public enum Month {

    JANUARY(1, "January"),
    FEBRUARY(2, "February"),
    MARCH(3, "March"),
    APRIL(4, "April"),
    MAY(5, "May"),
    JUNE(6, "June"),
    JULY(7, "July"),
    AUGUST(8, "August"),
    SEPTEMBER(9, "September"),
    OCTOBER(10, "October"),
    NOVEMBER(11, "November"),
    DECEMBER(12, "December");


    private final Integer numMonth;

    private final String englishMonth;

    Month(Integer numMonth, String englishMonth) {
        this.numMonth = numMonth;
        this.englishMonth = englishMonth;
    }

    public Integer getNumMonth() {
        return numMonth;
    }

    public String getEnglishMonth() {
        return englishMonth;
    }

    public static String match(Integer key) {
        for (Month value : values()) {
            if (value.getNumMonth().equals(key)) {
                return value.getEnglishMonth();
            }
        }
        return null;
    }
}
